<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>学生手册 | 武汉学院学生服务器操作手册</title>
    <meta name="generator" content="VuePress 1.9.9">
    <link rel="icon" href="./favicon.ico">
    <meta name="description" content="为同学打造一个展示作品、分享作品、学习作品的优质平台">
    
    <link rel="preload" href="./assets/css/0.styles.0e8e9d75.css" as="style"><link rel="preload" href="./assets/js/app.cec404b7.js" as="script"><link rel="preload" href="./assets/js/2.136ab042.js" as="script"><link rel="preload" href="./assets/js/10.83937a6f.js" as="script"><link rel="prefetch" href="./assets/js/3.1e4d5bdf.js"><link rel="prefetch" href="./assets/js/4.f9c2f627.js"><link rel="prefetch" href="./assets/js/5.abe37784.js"><link rel="prefetch" href="./assets/js/6.8434bce0.js"><link rel="prefetch" href="./assets/js/7.a78b49fa.js"><link rel="prefetch" href="./assets/js/8.34d19558.js"><link rel="prefetch" href="./assets/js/9.693ca9a7.js">
    <link rel="stylesheet" href="./assets/css/0.styles.0e8e9d75.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/./" class="home-link router-link-active"><!----> <span class="site-name">武汉学院学生服务器操作手册</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <!----></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!---->  <ul class="sidebar-links"><li><a href="/./operation/" aria-current="page" class="sidebar-link">武汉学院学生服务器</a></li><li><a href="/./operation/admin.html" class="sidebar-link">管理员手册</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/./operation/admin.html#操作准备" class="sidebar-link">操作准备</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/./operation/admin.html#账号准备" class="sidebar-link">账号准备</a></li><li class="sidebar-sub-header"><a href="/./operation/admin.html#学校-vpn-连接" class="sidebar-link">学校 VPN 连接</a></li><li class="sidebar-sub-header"><a href="/./operation/admin.html#登录后台" class="sidebar-link">登录后台</a></li></ul></li><li class="sidebar-sub-header"><a href="/./operation/admin.html#分配虚拟机操作" class="sidebar-link">分配虚拟机操作</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/./operation/admin.html#添加虚拟机" class="sidebar-link">添加虚拟机</a></li></ul></li><li class="sidebar-sub-header"><a href="/./operation/admin.html#操作虚拟机-安装系统centos" class="sidebar-link">操作虚拟机(安装系统centos)</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/./operation/admin.html#_1、远程操作" class="sidebar-link">1、远程操作</a></li><li class="sidebar-sub-header"><a href="/./operation/admin.html#_2、连接虚拟机" class="sidebar-link">2、连接虚拟机</a></li></ul></li><li class="sidebar-sub-header"><a href="/./operation/admin.html#最后" class="sidebar-link">最后</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/./operation/admin.html#转交虚拟机给学生" class="sidebar-link">转交虚拟机给学生</a></li></ul></li></ul></li><li><a href="/./operation/student.html" aria-current="page" class="active sidebar-link">学生手册</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/./operation/student.html#准备" class="sidebar-link">准备</a></li><li class="sidebar-sub-header"><a href="/./operation/student.html#_1-安装-mysql" class="sidebar-link">1. 安装 MySQL</a></li><li class="sidebar-sub-header"><a href="/./operation/student.html#_2-安装-redis" class="sidebar-link">2. 安装 Redis</a></li><li class="sidebar-sub-header"><a href="/./operation/student.html#_3-安装-java8" class="sidebar-link">3. 安装 Java8</a></li><li class="sidebar-sub-header"><a href="/./operation/student.html#_4-安装-node-js" class="sidebar-link">4. 安装 Node.js</a></li><li class="sidebar-sub-header"><a href="/./operation/student.html#_5-安装-python" class="sidebar-link">5. 安装 Python</a></li><li class="sidebar-sub-header"><a href="/./operation/student.html#_6-安装nginx" class="sidebar-link">6. 安装Nginx</a></li><li class="sidebar-sub-header"><a href="/./operation/student.html#安装宝塔可视化管理" class="sidebar-link">安装宝塔可视化管理</a></li><li class="sidebar-sub-header"><a href="/./operation/student.html#配置环境变量" class="sidebar-link">配置环境变量</a></li></ul></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="学生手册"><a href="#学生手册" class="header-anchor">#</a> 学生手册</h1> <h2 id="准备"><a href="#准备" class="header-anchor">#</a> 准备</h2> <p>现在是一台全新的centos系统的虚拟机：</p> <p><strong>一、centos7搭建jdk1.8</strong></p> <p><strong>1、yum方式安装</strong></p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment">#安装jdk1.8</span>
yum <span class="token function">install</span> java-1.8.0-openjdk-devel.x86_64

<span class="token comment">#yum install java-1.8.0-openjdk 安装单一java缺少javac开发环境</span>

<span class="token comment">#安装jdk11</span>
yum <span class="token function">install</span> java-11-openjdk-devel.x86_64

<span class="token comment">#查看和切换java版本，输入对应的编号切换</span>
alternatives <span class="token parameter variable">--config</span> <span class="token function">java</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><p><strong>2、解压缩包方式安装</strong></p> <p><strong>（1） 去Oracle官网下载需要安装的jdk 版本, 并上传到服务器。官网网址：</strong></p> <p><strong>https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html</strong></p> <h2 id="_1-安装-mysql"><a href="#_1-安装-mysql" class="header-anchor">#</a> 1. 安装 MySQL</h2> <p>在 CentOS 上安装 MySQL，可以使用 yum 命令进行安装，具体步骤如下：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
# 更新系统软件包
sudo yum update -y

# 安装 MySQL
sudo yum install mysql-server -y

# 启动 MySQL 服务
sudo systemctl start mysqld

# 设置 MySQL 开机自启
sudo systemctl enable mysqld
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h2 id="_2-安装-redis"><a href="#_2-安装-redis" class="header-anchor">#</a> 2. 安装 Redis</h2> <p>在 CentOS 上安装 Redis，可以使用 yum 命令进行安装，具体步骤如下：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
# 安装 Redis
sudo yum install redis -y

# 启动 Redis 服务
sudo systemctl start redis

# 设置 Redis 开机自启
sudo systemctl enable redis
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h2 id="_3-安装-java8"><a href="#_3-安装-java8" class="header-anchor">#</a> 3. 安装 Java8</h2> <p>在 CentOS 上安装 Java8，可以使用 yum 命令进行安装，具体步骤如下：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
# 安装 Java8
sudo yum install java-1.8.0-openjdk -y

# 查看 Java 版本
java -version
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h2 id="_4-安装-node-js"><a href="#_4-安装-node-js" class="header-anchor">#</a> 4. 安装 Node.js</h2> <p>在 CentOS 上安装 Node.js，可以使用 yum 命令进行安装，具体步骤如下：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
# 安装 Node.js
sudo yum install nodejs -y

# 安装 npm
sudo yum install npm -y

# 查看 Node.js 版本
node -v

# 查看 npm 版本
npm -v
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h2 id="_5-安装-python"><a href="#_5-安装-python" class="header-anchor">#</a> 5. 安装 Python</h2> <p>在 CentOS 上安装 Python，可以使用 yum 命令进行安装，具体步骤如下：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
# 安装 Python
sudo yum install python3 -y

# 查看 Python 版本
python3 -V
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p>以上就是在 CentOS 上安装 MySQL、Redis、Java8、Node.js 和 Python 等环境的步骤，如果需要安装其他环境，也可以使用相应的命令进行安装。</p> <h2 id="_6-安装nginx"><a href="#_6-安装nginx" class="header-anchor">#</a> 6. 安装Nginx</h2> <ol><li>安装 EPEL 源</li></ol> <p>Nginx 不是 CentOS 官方软件仓库中的软件包，因此需要先安装 EPEL 源（Extra Packages for Enterprise Linux）。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
sudo yum install epel-release -y
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ol><li>安装 Nginx</li></ol> <p>使用 yum 命令安装 Nginx：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
sudo yum install nginx -y
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ol><li>启动 Nginx</li></ol> <p>使用 systemctl 命令启动 Nginx：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
sudo systemctl start nginx
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>可以使用以下命令检查 Nginx 是否已经启动：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
sudo systemctl status nginx
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><ol><li>配置防火墙</li></ol> <p>如果系统防火墙已经启动，需要打开 HTTP 和 HTTPS 服务端口：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><ol><li>测试 Nginx</li></ol> <p>可以在浏览器中访问服务器 IP 地址或者域名，看是否能够访问 Nginx 默认欢迎页面，地址为：<code>http://服务器 IP 地址/</code>。</p> <p>以上就是在 CentOS 上安装 Nginx 的步骤，如果需要自定义配置 Nginx，可以编辑 <code>/etc/nginx/nginx.conf</code> 文件进行配置。</p> <h2 id="安装宝塔可视化管理"><a href="#安装宝塔可视化管理" class="header-anchor">#</a> 安装宝塔可视化管理</h2> <p>参照官网示例进行安装即可：</p> <p>https://www.bt.cn/new/index.html</p> <h2 id="配置环境变量"><a href="#配置环境变量" class="header-anchor">#</a> 配置环境变量</h2> <p>在 CentOS 上安装 MySQL、Redis、Java8、Node.js 和 Python 等环境后，可能需要配置相应的环境变量，以便在终端中使用相应的命令。下面是具体的环境变量配置步骤：</p> <ol><li>MySQL 环境变量配置：</li></ol> <p>MySQL 安装路径一般为 <code>/usr/bin/mysql</code>，需要将该路径添加到 PATH 环境变量中。可以使用以下命令进行配置：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
echo 'export PATH=&quot;/usr/bin/mysql:$PATH&quot;' &gt;&gt; ~/.bashrc
source ~/.bashrc
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><ol><li>Redis 环境变量配置：</li></ol> <p>Redis 安装路径一般为 <code>/usr/bin/redis-cli</code>，需要将该路径添加到 PATH 环境变量中。可以使用以下命令进行配置：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
echo 'export PATH=&quot;/usr/bin/redis-cli:$PATH&quot;' &gt;&gt; ~/.bashrc
source ~/.bashrc
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><ol><li>Java 环境变量配置：</li></ol> <p>Java 安装路径一般为 <code>/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/bin</code>，需要将该路径添加到 PATH 环境变量中。可以使用以下命令进行配置：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
echo 'export PATH=&quot;/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/bin:$PATH&quot;' &gt;&gt; ~/.bashrc
source ~/.bashrc
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><ol><li>Node.js 环境变量配置：</li></ol> <p>Node.js 安装路径一般为 <code>/usr/bin/node</code>，需要将该路径添加到 PATH 环境变量中。可以使用以下命令进行配置：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
echo 'export PATH=&quot;/usr/bin/node:$PATH&quot;' &gt;&gt; ~/.bashrc
source ~/.bashrc
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><ol><li>Python 环境变量配置：</li></ol> <p>Python3 安装路径一般为 <code>/usr/bin/python3</code>，需要将该路径添加到 PATH 环境变量中。可以使用以下命令进行配置：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>bashCopy code
echo 'export PATH=&quot;/usr/bin/python3:$PATH&quot;' &gt;&gt; ~/.bashrc
source ~/.bashrc
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><p>以上是在 CentOS 上安装 MySQL、Redis、Java8、Node.js 和 Python 等环境后的环境变量配置步骤，根据实际情况进行配置即可。</p></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated:</span> <span class="time">4/7/2023, 4:23:52 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/./operation/admin.html" class="prev">
        管理员手册
      </a></span> <!----></p></div> </main></div><div class="global-ui"><!----></div></div>
    <script src="./assets/js/app.cec404b7.js" defer></script><script src="./assets/js/2.136ab042.js" defer></script><script src="./assets/js/10.83937a6f.js" defer></script>
  </body>
</html>
